<template>
  <div class="header">
    <div class="header-left">
      <div class="logo">
        <SelectCompanyFour></SelectCompanyFour>
      </div>
    </div>
    <div class="header-center">
      <div class="title">{{ orgName }}生物资产看板</div>
    </div>
    <div class="header-right">
      <div>{{ currentTime }}</div>
      <FullScreen />
    </div>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue'
import SelectCompanyFour from '../SelectCompanyFour.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const currentTime = ref()

const orgName = computed(() => decodeURIComponent(route.query.orgName))
function getCurrentTime() {
  const now = new Date()

  const year = now.getFullYear() // 获取年份
  const month = String(now.getMonth() + 1).padStart(2, '0') // 获取月份，注意月份从0开始
  const day = String(now.getDate()).padStart(2, '0') // 获取日期

  const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  const weekday = weekdays[now.getDay()] // 获取星期几

  const hours = String(now.getHours()).padStart(2, '0') // 获取小时
  const minutes = String(now.getMinutes()).padStart(2, '0') // 获取分钟
  const seconds = String(now.getSeconds()).padStart(2, '0') // 获取秒数

  currentTime.value = `${year}年 ${month}月 ${day}日  ${weekday}  ${hours} : ${minutes} : ${seconds}`
}

// 实时输出当前时间
setInterval(() => {
  getCurrentTime()
}, 1000)
</script>

<style scoped lang="scss">
.header {
  font-size: 18px;
  padding: 0 20px;
  justify-content: space-between;
  align-items: center;
  height: 100px;
  display: flex;
  background: url('../../assets/u2359.png') no-repeat center center;

  &-left {
    width: 400px;
    display: flex;
    justify-self: flex-start;
  }

  &-center {
    flex: 1;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
    font-family: '微软雅黑 Bold', '微软雅黑', sans-serif;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    line-height: normal;
    font-size: 24px;
  }

  &-right {
    width: 400px;
    display: flex;
    justify-content: flex-end;
  }
}
</style>
